---
sidebar_position: 5
---

# Tracking token usage

This notebook goes over how to track your token usage for specific calls. This is currently only implemented for the OpenAI API.

Here's an example of tracking token usage for a single Chat model call:

import CodeBlock from "@theme/CodeBlock";
import Example from "@examples/models/chat/token_usage_tracking.ts";

import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx";

<IntegrationInstallTooltip></IntegrationInstallTooltip>

```bash npm2yarn
npm install @langchain/openai
```

<CodeBlock language="typescript">{Example}</CodeBlock>

If this model is passed to a chain or agent that calls it multiple times, it will log an output each time.
